Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(manifest): add option to disable manifest file hash #193

Closed
wants to merge 1 commit into from

Conversation

mdawar
Copy link

@mdawar mdawar commented Jun 8, 2019

As per the WebAPKs guide on Google Developers website, it's recommended to not change the manifest file name:

Chrome will only update a WebAPK if the Web Manifest URL does not change. If you change the web page from referencing <link rel="manifest.json"> to reference <link rel="manifest2.json"> the WebAPK will no longer update. (Don't do this!)

So I have added an option to disable the manifest file hash while keeping the default to true.

@mdawar
Copy link
Author

mdawar commented Jun 8, 2019

By the way, I know this is not the right place to discuss this but last time I tried to submit an issue I used https://cmty.app/nuxt/issues/new?repo=pwa-module but the issue was created there and not imported to Github, do I have to do anything to import the issue to Github?

@pi0
Copy link
Member

pi0 commented Jun 8, 2019

Thanks, @mdawar for discovery and PR. So as of WebAPK requirement it seems would be a better idea to make this default behavior to not hash manifest file name.

My only concern is that assets inside /_nuxt/ are permanently cached and manifest will be generated there. We have to somehow generate it outside or override cache header.

@mdawar
Copy link
Author

mdawar commented Jun 8, 2019

@pi0 Yes I think you're right, the default should be false.

And I was going to ask you how to generate the manifest file like the service worker file in the static folder, I used publicPath but it only changes the link tag path and not the file path.

@pi0
Copy link
Member

pi0 commented Jun 8, 2019

Generating to static was not a good idea. If you are not in a hurry I'd do some refactors to add required functionalities for this one.

@mdawar
Copy link
Author

mdawar commented Jun 8, 2019

Yes no probem, I thought of the static folder just to make it at the root directory just like the workbox module does.

Do you want me to set the default fileHash option to false or you will do it in the refactor?

@pi0
Copy link
Member

pi0 commented Jun 8, 2019

The problem with static folder is that people have to ignore it from version control and also does not guarantee a precisely correct hash header.

I'll include it in changes and certainly, keep your credits for this :)

@P4sca1
Copy link

P4sca1 commented Oct 26, 2019

Any news here?

@mdawar
Copy link
Author

mdawar commented Oct 27, 2019

@P4sca1 I don't think it was added, @pi0 was refactoring the code, I'm currently manually editing the file in the node_modules folder after installing the package, just change the const manifestFileName to manifest.json if you need this feature temporarily.

@AlexAsh
Copy link

AlexAsh commented Jan 5, 2020

It should be possible to use [name].[ext]?[hash] naming scheme. This way you both keep name and invalidate cache on change. Also it would be handy to edit naming scheme in config for manifest and icons like you do it for webpack loaders. What do you think about it @pi0 ? I'm willing to make PR in few weeks.

@pi0 pi0 changed the title [manifest] add option to disable manifest.json file hash feat(manifest) add option to disable manifest file hash Mar 12, 2020
@pi0 pi0 changed the title feat(manifest) add option to disable manifest file hash feat(manifest): add option to disable manifest file hash Mar 12, 2020
@pi0 pi0 closed this in f05353b Mar 12, 2020
@pi0
Copy link
Member

pi0 commented Mar 12, 2020

Hi @mdawar @AlexAsh. Sorry for the delay with this. I've added fileName template support via f05353b so according to requirements it can be set to all possible values:

  • (default) manifest.[hash].[ext]
  • manifest.[ext] or manifest.json
  • manifest.json?[hash]

Still, I believe it is better to remove hash by default but before that Nuxt has to support injecting static assets with custom caching headers.

@JesseCorbett
Copy link

Will this feature be released any time soon? The fact that this cannot be resolved on user device without manual intervention once the issue has occurred makes this a pressing issue to still be happening in production

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants